import 'package:chathouse/pages/base/base.dart';
import 'package:chathouse/pages/expert/wallet_page.dart';
import 'package:chathouse/public/Config.dart';
import 'package:chathouse/public/NetworkImageBrowser.dart';
import 'package:chathouse/util/base_utils.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../../chat/chat_page.dart';
import '../../model/expert_service_bean.dart';
import '../../model/member_info.dart' as memberInfo;
import '../../util/log.dart';

// ignore: must_be_immutable
class ExpertServiceDetailPage extends BaseStatefulWidget {
  num serviceId;

  ExpertServiceDetailPage(this.serviceId, {Key? key}) : super(key: key);

  @override
  // ignore: no_logic_in_create_state
  _ServiceDetailPageState createState() => _ServiceDetailPageState(serviceId);
}

class _ServiceDetailPageState
    extends BaseStatefulWidgetState<ExpertServiceDetailPage> {
  Data? detail;

  bool isShowDetail = false;
  num serviceId;
  num? seendSerivcePrice;

  String? memberNo;
  memberInfo.MemberInfo? _memberInfo;
  String memberPhone = '';

  List<String> images = [];
  List<String> decreePathImages = [];

  _ServiceDetailPageState(this.serviceId);

  @override
  void initState() {
    super.initState();
    updateEmptyPage(tipTitle: "暫無服務數據");
    setState(() {
      updateState(LoadState.loading);
      appBarTitle = "客戶資料";
      showAppBar = true;
      scaffoldBackColor = Colors.white;
    });
    loadSimpleService();
  }

  checkLookPermission() {
    final param = {"projectId": detail?.projectId};
    Apis.getLookProjectPermission(param).then((value) {
      var param = value?.data ?? {};
      if (param["code"] == 500) {
        seendSerivcePrice = param["data"];
        seendPriceShow();
      }
      if (param["code"] == 200) {
        loadSerivce();
      }
    }).catchError((error) {
      Obj.dismissLoading();
    });
  }

  void loadSimpleService() {
    Apis.simpleServiceDetail(serviceId.toString())
        .then((response) => {
              setState(() {
                var data = response?.data["data"];
                detail = Data.fromJson(data);
                if (detail?.quote == true || detail?.readFlag == "1") {
                  loadSerivce();
                }
                if (detail?.quote == true){
                  memberNo = detail?.membersNo??'';
                  getMembersInfo();
                }
                //延时500毫秒执行
                Future.delayed(const Duration(milliseconds: 500), () {
                  setState(() {
                    updateState(LoadState.success);
                  });
                });
              })
            })
        .onError((error, stackTrace) =>
            {updateState(LoadState.empty), print(error)});
  }

  void loadSerivce() {
    images = [];
    Apis.serviceDetail(serviceId.toString())
        .then((response) => {
              setState(() {
                (LoadState.success);
                var data = response?.data["data"];
                detail = Data.fromJson(data);
                if (detail?.quote == true || detail?.readFlag == "1") {
                  isShowDetail = true;
                }
                var path = detail?.imagePath;
                if (path != null && path.isNotEmpty) {
                  if (path.contains(",")) {
                    images = path.split(",");
                  } else {
                    images.add(path);
                  }
                }
                var decreePath = detail?.decreePath;
                if (decreePath != null && decreePath.isNotEmpty) {
                  if (decreePath.contains(",")) {
                    decreePathImages = decreePath.split(",");
                  } else {
                    decreePathImages.add(decreePath);
                  }
                }

                print("images : ${images}");
                print("decreePathImages : ${decreePathImages}");
                setState(() {});
              })
            })
        .onError((error, stackTrace) => {(LoadState.empty), print(error)});
  }

  getMembersInfo() {
    // Obj.showLoading();
    Apis.getMembersInfoForNo(memberNo).then((value) {
      // print('getMembersInfoForNo value');
      // print(value.toString());
      // Obj.dismissLoading();
      (LoadState.success);
      var jsonData = value?.data;
      _memberInfo = memberInfo.MemberInfo.fromJson(jsonData);

      memberPhone = _memberInfo?.data?.membersPhone??'';

      LogUtil.d("getMembersInfo success ");
      setState(() {});
    }).catchError((error) {
      Obj.dismissLoading();
      LogUtil.d("getMembersInfo error");
    });
  }

  showBackMsg() {
    showDialog(
        context: context,
        barrierColor: Colors.black54,
        builder: (BuildContext context) {
          return Container(
            // color: Colors.black26,
            child: Center(
              child: Container(
                padding: EdgeInsets.symmetric(vertical: 20.w, horizontal: 20.w),
                width: 358.w,
                height: 350.w,
                decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.circular(Styles.magin_40)),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: [
                    Text("提示",
                        textAlign: TextAlign.center,
                        style: getTextStyle(29.sp,
                            fontType: FontType.BOLD,
                            color: Styles.colorHomeRight)),
                    SizedBox(
                      height: 12.w,
                    ),
                    Text("該服務已聘用了專家,仍然查看資料？",
                        textAlign: TextAlign.center,
                        style: getTextStyle(29.sp,
                            fontType: FontType.MID, color: Styles.c_191919)),
                    SizedBox(
                      height: 36.w,
                    ),
                    Container(
                      alignment: Alignment.center,
                      width: 164.w,
                      height: 54.w,
                      decoration: BoxDecoration(
                          color: Styles.FF9800,
                          borderRadius: BorderRadius.circular(Styles.magin_18)),
                      child: Text(
                        "是",
                        style: TextStyle(
                            color: Colors.white,
                            fontWeight: FontWeight.w500,
                            fontSize: 20.w),
                      ),
                    ).setOnClickListener(() {
                      Navigator.pop(context);
                      checkLookPermission();
                    }),
                    SizedBox(
                      height: 16.w,
                    ),
                    Container(
                      alignment: Alignment.center,
                      width: 164.w,
                      height: 54.w,
                      decoration: BoxDecoration(
                          color: Styles.c_999,
                          borderRadius: BorderRadius.circular(Styles.magin_18)),
                      child: Text(
                        "否",
                        style: TextStyle(
                            color: Colors.white,
                            fontWeight: FontWeight.w500,
                            fontSize: 20.w),
                      ),
                    ).setOnClickListener(() {
                      Navigator.pop(context);
                    }),
                  ],
                ),
              ),
            ),
          );
          // );
        });
  }

  showQuoteMsg() {
    showDialog(
        context: context,
        barrierColor: Colors.black54,
        builder: (BuildContext context) {
          return Container(
            // color: Colors.black26,
            child: Center(
              child: Container(
                padding: EdgeInsets.symmetric(vertical: 20.w, horizontal: 20.w),
                width: 358.w,
                height: 280.w,
                decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.circular(Styles.magin_40)),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: [
                    Text("提示",
                        textAlign: TextAlign.center,
                        style: getTextStyle(29.sp,
                            fontType: FontType.BOLD,
                            color: Styles.colorHomeRight)),
                    SizedBox(
                      height: 12.w,
                    ),
                    Text("該服務已聘用了專家,不可再進行報價",
                        textAlign: TextAlign.center,
                        style: getTextStyle(29.sp,
                            fontType: FontType.MID, color: Styles.c_191919)),
                    SizedBox(
                      height: 36.w,
                    ),
                    Container(
                      alignment: Alignment.center,
                      width: 164.w,
                      height: 54.w,
                      decoration: BoxDecoration(
                          color: Styles.FF9800,
                          borderRadius: BorderRadius.circular(Styles.magin_18)),
                      child: Text(
                        "知道了",
                        style: TextStyle(
                            color: Colors.white,
                            fontWeight: FontWeight.w500,
                            fontSize: 20.w),
                      ),
                    ).setOnClickListener(() {
                      Navigator.pop(context);
                    }),
                  ],
                ),
              ),
            ),
          );
          // );
        });
  }

  toChat() {
    final map = {
      "reviceuserId": detail?.membersNo,
      "projectNo": detail?.projectNo,
      "memberImage": detail?.memberImage,
      "membersName": detail?.membersName,
      "projectId": detail?.projectId,
    };
    LogUtil.d("专家 map $map");
    Get.to(ChatPage(map));
  }

  void quote() {
    var map = {
      "projectNo": detail?.projectNo,
      "membersId": detail?.membersId,
      "membersName": detail?.membersName,
      "membersNo": detail?.membersNo,
      "projectId": detail?.projectId,
      "projectName": detail?.projectName
    };
    Obj.showLoading();
    Apis.serviceQuote(map)
        .then((value) =>
            {Obj.dismissLoading(), Navigator.pop(context), loadSerivce()})
        .onError((error, stackTrace) => {Obj.dismissLoading(), print(error)});
  }

  seeDetail() {
    isShowDetail = true;
    setState(() {});
  }

  quotedPrice() {
    showDialog(
        context: context,
        builder: (BuildContext context) {
          return Scaffold(
            body: Container(
              color: Colors.black54,
              child: Center(
                child: Container(
                  padding:
                      EdgeInsets.symmetric(vertical: 20.w, horizontal: 28.w),
                  width: 358.w,
                  height: 400.w,
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.circular(Styles.magin_16)),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Text("發出報價",
                          style: getTextStyle(24.sp,
                              fontType: FontType.BOLD,
                              color: Styles.mainColor)),
                      SizedBox(
                        height: 20.w,
                      ),
                      RichText(
                        textAlign: TextAlign.center,
                        text: TextSpan(
                            text: "發出這次報價需支付",
                            style: getTextStyle(25.sp,
                                fontType: FontType.MID, color: Styles.c_191919),
                            children: [
                              TextSpan(
                                  text:
                                      "${detail?.goldCoinDemand?.toInt() ?? 0}",
                                  style: getTextStyle(25.sp,
                                      fontType: FontType.BOLD,
                                      color: Styles.mainColor)),
                              const TextSpan(text: "個金幣"),
                            ]),
                      ),
                      Expanded(
                        flex: 1,
                        child: Container(),
                      ),
                      Container(
                        alignment: Alignment.center,
                        width: 175.w,
                        height: 41.w,
                        decoration: BoxDecoration(
                            color: Styles.c_FF9090,
                            borderRadius:
                                BorderRadius.circular(Styles.magin_18)),
                        child: Text(
                          "確認支付",
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 20.w,
                              fontWeight: FontWeight.w500),
                        ),
                      ).setOnClickListener(() {
                        quote();
                      }),
                      SizedBox(
                        height: 12.w,
                      ),
                      Container(
                        alignment: Alignment.center,
                        width: 175.w,
                        height: 41.w,
                        decoration: BoxDecoration(
                            color: Styles.mainColor,
                            borderRadius:
                                BorderRadius.circular(Styles.magin_18)),
                        child: Text(
                          "購買金幣",
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 22.w,
                              fontWeight: FontWeight.w500),
                        ),
                      ).setOnClickListener(() {
                        Get.to(const WealletPage());
                      }),
                      SizedBox(
                        height: 12.w,
                      ),
                      Container(
                        alignment: Alignment.center,
                        width: 175.w,
                        height: 41.w,
                        decoration: BoxDecoration(
                            color: Styles.c_999,
                            borderRadius:
                                BorderRadius.circular(Styles.magin_18)),
                        child: Text(
                          "取消",
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 20.w,
                              fontWeight: FontWeight.w500),
                        ),
                      ).setOnClickListener(() {
                        Navigator.pop(context);
                      })
                    ],
                  ),
                ),
              ),
            ),
          );
        });
  }

  seendPriceShow() {
    showDialog(
        context: context,
        builder: (BuildContext context) {
          return Scaffold(
            body: Container(
              color: Colors.black54,
              child: Center(
                child: Container(
                  padding:
                      EdgeInsets.symmetric(vertical: 20.w, horizontal: 28.w),
                  width: 358.w,
                  height: 400.w,
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.circular(Styles.magin_16)),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Text("查看詳情",
                          style: getTextStyle(24.sp,
                              fontType: FontType.BOLD,
                              color: Styles.mainColor)),
                      SizedBox(
                        height: 20.w,
                      ),
                      RichText(
                        textAlign: TextAlign.center,
                        text: TextSpan(
                            text: "查看服務詳情需支付",
                            style: getTextStyle(25.sp,
                                fontType: FontType.MID, color: Styles.c_191919),
                            children: [
                              TextSpan(
                                  text: "${seendSerivcePrice?.toInt() ?? 0}",
                                  style: getTextStyle(25.sp,
                                      fontType: FontType.BOLD,
                                      color: Styles.mainColor)),
                              const TextSpan(text: "個金幣"),
                            ]),
                      ),
                      Expanded(
                        flex: 1,
                        child: Container(),
                      ),
                      Container(
                        alignment: Alignment.center,
                        width: 175.w,
                        height: 41.w,
                        decoration: BoxDecoration(
                            color: Styles.c_FF9090,
                            borderRadius:
                                BorderRadius.circular(Styles.magin_18)),
                        child: Text(
                          "確認支付",
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 20.w,
                              fontWeight: FontWeight.w500),
                        ),
                      ).setOnClickListener(() {
                        loadSerivce();
                        Get.back();
                      }),
                      SizedBox(
                        height: 12.w,
                      ),
                      Container(
                        alignment: Alignment.center,
                        width: 175.w,
                        height: 41.w,
                        decoration: BoxDecoration(
                            color: Styles.mainColor,
                            borderRadius:
                                BorderRadius.circular(Styles.magin_18)),
                        child: Text(
                          "購買金幣",
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 22.w,
                              fontWeight: FontWeight.w500),
                        ),
                      ).setOnClickListener(() {
                        Get.to(const WealletPage());
                      }),
                      SizedBox(
                        height: 12.w,
                      ),
                      Container(
                        alignment: Alignment.center,
                        width: 175.w,
                        height: 41.w,
                        decoration: BoxDecoration(
                            color: Styles.c_999,
                            borderRadius:
                                BorderRadius.circular(Styles.magin_18)),
                        child: Text(
                          "取消",
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 20.w,
                              fontWeight: FontWeight.w500),
                        ),
                      ).setOnClickListener(() {
                        Navigator.pop(context);
                      })
                    ],
                  ),
                ),
              ),
            ),
          );
        });
  }

  Widget item(JsonRespList model) {
    return Container(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Text(model.problemName ?? '',
              textAlign: TextAlign.left,
              style: getTextStyle(18.sp,
                  fontType: FontType.MID, color: Styles.c_191919)),
          SizedBox(
            height: 4.w,
          ),
          Text(model.optionValue ?? '',
              textAlign: TextAlign.left,
              style: getTextStyle(18.sp,
                  fontType: FontType.MID, color: Styles.mainColor)),
          SizedBox(
            height: 4.w,
          ),
        ],
      ),
    );
  }

  Widget imageItem(List<String> urls, int idx) {
    if (urls.length == 0) {
      return Container();
    }
    return InkWell(
      onTap: () {
        Get.to(NetworkImageBrowser(
          imageUrls: urls,
          idx: idx,
        ));
      },
      child: Container(
        margin: EdgeInsets.only(right: 6.w),
        child: ClipRRect(
          borderRadius: BorderRadius.all(Radius.circular(8.w)),
          child: ImageUtils.image(urls[idx],
              imageType: ImageType.NETWORK,
              width: 66.w,
              height: 66.w,
              fit: BoxFit.cover),
        ),
      ),
    );
  }

  Widget userImg() {
    return Visibility(
      visible: images.isNotEmpty,
      child: Container(
        margin: EdgeInsets.only(top: 16.w),
        alignment: Alignment.centerLeft,
        child: Text("客戶所提供相片",
            style: getTextStyle(18.sp,
                fontType: FontType.MID, color: Styles.c_191919)),
      ),
    );
  }

  @override
  Widget viewPageBody() {
    return Stack(
      children: [
        Padding(
          padding:
              EdgeInsets.only(left: 40.w, right: 40.w, top: 8.w, bottom: 20.w),
          child: ListView(
            physics: isShowDetail == false
                ? const NeverScrollableScrollPhysics()
                : const AlwaysScrollableScrollPhysics(),
            children: [
              Container(
                // width: 100.w,
                height: 96.w,
                decoration: BoxDecoration(
                    color: Styles.c_f5f5f7,
                    borderRadius: BorderRadius.circular(Styles.magin_16)),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    detail?.memberImage == null || isShowDetail == false
                        ? ImageUtils.image(Res.expert_avatar,
                            width: 66.w,
                            height: 66.w,
                            imageType: ImageType.ASSET)
                        : ImageUtils.image(detail?.memberImage ?? "",
                            width: 66.w,
                            height: 66.w,
                            imageType: ImageType.NETWORK,
                            radius: 33.w),
                    SizedBox(
                      width: 10.w,
                    ),
                    Text(detail?.membersName ?? "",
                        style: getTextStyle(18.sp,
                            fontType: FontType.BOLD, color: Colors.black)),
                  ],
                ),
              ),
              SizedBox(
                height: 16.w,
              ),
              Container(
                alignment: Alignment.centerLeft,
                child: Text("聯絡方式",
                    style: getTextStyle(16.sp,
                        fontType: FontType.MID, color: Styles.c_666)),
              ),
              SizedBox(
                height: 4.w,
              ),
              Container(
                alignment: Alignment.centerLeft,
                child: Text("+${memberPhone??''}",
                    // isShowDetail == false
                    //     ? "+853 XXX XXX XXX"
                    //     : "+${detail?.membersPhone ?? ""}",
                    style: getTextStyle(16.sp,
                        fontType: FontType.MID, color: Styles.c_666)),
              ),
              SizedBox(
                height: 16.w,
              ),
              Container(
                  padding:
                      EdgeInsets.symmetric(horizontal: 25.w, vertical: 16.w),
                  decoration: BoxDecoration(
                    border: Border.all(width: 1.0, color: Styles.c_666),
                    borderRadius: BorderRadius.all(Radius.circular(16.w)),
                  ),
                  child: ListView.builder(
                    shrinkWrap: true,
                    itemBuilder: (context, index) {
                      if (index == detail!.jsonRespList!.length) {
                        return userImg();
                      }
                      return item(detail!.jsonRespList![index]);
                    },
                    physics: const NeverScrollableScrollPhysics(),
                    itemCount: detail?.jsonRespList?.length ?? 0,
                  )),
              SizedBox(
                height: 16.w,
              ),
              Visibility(
                visible: images.isNotEmpty,
                child: Container(
                  alignment: Alignment.centerLeft,
                  child: Text("客戶所提供相片",
                      style: getTextStyle(18.sp,
                          fontType: FontType.MID, color: Styles.c_191919)),
                ),
              ),
              Visibility(
                visible: images.isNotEmpty,
                child: SizedBox(
                  height: 8.w,
                ),
              ),
              Visibility(
                visible: images.isNotEmpty,
                child: SizedBox(
                  width: MediaQuery.of(context).size.width - 80.w,
                  height: 66.w,
                  child: ListView.builder(
                    shrinkWrap: true,
                    itemBuilder: (context, index) {
                      return imageItem(images, index);
                    },
                    scrollDirection: Axis.horizontal,
                    itemCount: images.length,
                  ),
                ),
              ),
              SizedBox(
                height: 8.w,
              ),
              Visibility(
                visible: detail?.decreePath?.isNotEmpty ?? false,
                child: Container(
                  alignment: Alignment.centerLeft,
                  child: Text("法令圖片",
                      style: getTextStyle(18.sp,
                          fontType: FontType.MID, color: Styles.c_191919)),
                ),
              ),
              SizedBox(
                height: 8.w,
              ),
              Visibility(
                visible: detail?.decreePath?.isNotEmpty ?? false,
                child: SizedBox(
                  width: MediaQuery.of(context).size.width - 80.w,
                  height: 66.w,
                  child: ListView.builder(
                    shrinkWrap: true,
                    itemBuilder: (context, index) {
                      return imageItem(decreePathImages, index);
                    },
                    scrollDirection: Axis.horizontal,
                    itemCount: decreePathImages.length,
                  ),
                ),
              ),
              SizedBox(
                height: 60.w,
              ),
              InkWell(
                  onTap: () {
                    // 已经报价
                    if (detail?.quote == true) {
                      toChat();
                      return;
                    }
                    // 已經聘用了专家
                    if (detail?.projectState == "02" ||
                        detail?.projectState == "03") {
                      showQuoteMsg();
                    } else {
                      quotedPrice();
                    }
                  },
                  child: Container(
                    alignment: Alignment.center,
                    child: Container(
                      padding: EdgeInsets.symmetric(
                          vertical: 12.w, horizontal: 60.w),
                      decoration: BoxDecoration(
                          color: detail?.quote == false
                              ? Styles.color_F93A4A
                              : Styles.c_FF9090,
                          borderRadius: BorderRadius.circular(20.w)),
                      child: Text(
                        detail?.quote == false ? "發出報價" : "聯絡即時線上對話",
                        style: TextStyle(
                            color: Colors.white,
                            fontSize: 22.w,
                            fontWeight: FontWeight.w600),
                      ),
                    ),
                  )),
            ],
          ),
        ),
        Positioned(
          left: 0,
          right: 0,
          bottom: 0,
          child: Visibility(
            visible: !isShowDetail,
            child: Container(
              color: Colors.white,
              child: SizedBox(
                height: 300.w,
                child: SizedBox(
                  width: double.infinity,
                  child: Column(
                    children: [
                      const Text(
                        "......",
                        style: TextStyle(
                            fontSize: 22,
                            fontWeight: FontWeight.w700,
                            color: Styles.mainColor),
                      ),
                      const SizedBox(
                        height: 14,
                      ),
                      InkWell(
                        child: const Text(
                          "查看詳情",
                          style: TextStyle(
                              fontSize: 28,
                              fontWeight: FontWeight.w700,
                              color: Styles.mainColor),
                        ),
                        onTap: () {
                          // 已經聘用了专家
                          if (detail?.projectState == "02" ||
                              detail?.projectState == "03") {
                            showBackMsg();
                          } else {
                            checkLookPermission();
                          }
                        },
                      ),
                      const SizedBox(
                        height: 16,
                      ),
                      InkWell(
                        onTap: () => {},
                        child: Container(
                          padding: const EdgeInsets.symmetric(horizontal: 24),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.center,
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: [
                              Container(
                                width: 110.w,
                                height: 110.w,
                                decoration: BoxDecoration(
                                    color: Styles.color_F93A4A,
                                    borderRadius: BorderRadius.circular(60.w)),
                                child: Column(
                                  mainAxisAlignment: MainAxisAlignment.center,
                                  crossAxisAlignment: CrossAxisAlignment.center,
                                  children: [
                                    Text("金幣需求",
                                        style: TextStyle(
                                            fontSize: 19,
                                            fontWeight: FontWeight.w700,
                                            color: Colors.white)),
                                    const SizedBox(
                                      height: 4,
                                    ),
                                    Text("${detail?.goldCoinDemand ?? "0"}",
                                        style: TextStyle(
                                            fontSize: 19,
                                            fontWeight: FontWeight.w700,
                                            color: Colors.white))
                                  ],
                                ),
                              ),
                              const SizedBox(
                                width: 10,
                              ),
                              Container(
                                width: 110.w,
                                height: 110.w,
                                // padding: EdgeInsets.all(12),
                                decoration: BoxDecoration(
                                    color: Styles.mainColor,
                                    borderRadius: BorderRadius.circular(60.w)),
                                child: Column(
                                  mainAxisAlignment: MainAxisAlignment.center,
                                  crossAxisAlignment: CrossAxisAlignment.center,
                                  children: [
                                    const Text("報價人數",
                                        style: TextStyle(
                                            fontSize: 19,
                                            fontWeight: FontWeight.w700,
                                            color: Colors.white)),
                                    const SizedBox(
                                      height: 4,
                                    ),
                                    Text(
                                        "${detail?.newQuoting}/${detail?.numberOfPersonsQuoting}",
                                        style: const TextStyle(
                                            fontSize: 19,
                                            fontWeight: FontWeight.w700,
                                            color: Colors.white))
                                  ],
                                ),
                              ),
                              const SizedBox(
                                width: 12,
                              ),
                              Container(
                                width: 110.w,
                                height: 110.w,
                                decoration: BoxDecoration(
                                    color: Styles.c_3E6DCC,
                                    borderRadius: BorderRadius.circular(60.w)),
                                child: Column(
                                  mainAxisAlignment: MainAxisAlignment.center,
                                  crossAxisAlignment: CrossAxisAlignment.center,
                                  children: [
                                    Text("限時\n${detail?.dayNum ?? 0}日",
                                        textAlign: TextAlign.center,
                                        style: const TextStyle(
                                            fontSize: 20,
                                            fontWeight: FontWeight.w700,
                                            color: Colors.white)),
                                  ],
                                ),
                              ),
                            ],
                          ),
                        ),
                      ),
                      const SizedBox(
                        height: 28,
                      ),
                      InkWell(
                        onTap: () {
                          // 已经报价
                          if (detail?.quote == true) {
                            toChat();
                            return;
                          }
                          // 已經聘用了专家
                          if (detail?.projectState == "02" ||
                              detail?.projectState == "03") {
                            showQuoteMsg();
                          } else {
                            quotedPrice();
                          }
                          // checkLookPermission();
                        },
                        child: Container(
                          alignment: Alignment.center,
                          width: 220.w,
                          height: 46.w,
                          decoration: BoxDecoration(
                              color: detail?.quote == false
                                  ? Styles.color_F93A4A
                                  : Styles.c_FF9090,
                              borderRadius:
                                  BorderRadius.circular(Styles.magin_16)),
                          child: Text(
                            detail?.quote == false ? "發出報價" : "聯絡即時線上對話",
                            style: TextStyle(
                                color: Colors.white,
                                fontSize: 22.w,
                                fontWeight: FontWeight.w500),
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
            ),
          ),
        )
      ],
    );
  }
}
